/**
 * 退费表模型
 */
const db = require('./index');
const Schema = db.Schema;
const moment = require('moment');
const now = () => {
    return moment().format('YYYY-MM-DD HH:mm:ss')
}
const RefundSchema = new Schema({
    refundid: { type: String, require: true },//退款单号
    refundtime: { type: String, default: null },// 退款时间
    refundpayer: { type: String },//退款人 
    payphone: String,//手机号码
    ordertype: { type: String },//消费类型
    refundmoney: Number,//退款金额
    paystate: Boolean,//   支付状态 true:退款成功    false:退款失败
    paytype: String,//退款方式  现金支付或在线支付
    refundoperator: String,//退款操作人

    orderid: { type: String, require: true },//订单号
    consumptiontime: { type: String, default: null },// 订单创建时间
    receipts: Number,//   实际退费金额
    //收费明细
    chargeschedule: { type: {}, default: null },
    // p_name: String,// 收费名称
    // p_Number: Number,//数量
    // p_price: Number,//   单价
    // p_speci: String,//   规格
    // p_money: Number,//  金额
    // p_discount: Number,// 折扣
    // p_dismoney: Number,// 折后金额
    // p_doctor: String,//  接诊医生
    Medical_id: { type: {}, default: null }
});

const Refund = db.model('Refund', RefundSchema);
module.exports = Refund;